/**
 * Created by mill on 2017/11/19.
 */
import React , {Component} from 'react';
import {render} from 'react-dom';


class LikeButton extends Component{
    constructor(props){
        super(props)
        this.state={liked: false};
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick(e){
        this.setState({liked: !this.state.liked});
    }
    componentDidMount(){

    }
    render() {
       var text = this.state.liked ? 'like' : 'haven\'t liked';
    return (
      <p onClick={this.handleClick}>
        You {text} this. {this.props.title}Click to toggle.
      </p>
    );
    }
}
render(
    <LikeButton title={"liujian"}/>,
    document.getElementById("like")
);

